package huawei_security_go

// ------------------------------------------------------------
// Copyright (c) Huawei Technologies Co., Ltd. 2012-2019. All rights reserved.
// ------------------------------------------------------------
import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestSecurityDecryptor(t *testing.T) {

	t.Run("test local SecurityDecryptor", func(t *testing.T) {
		cp := Ciphers{
			WorkeyCipher: "20~A2~CABA5516BBCB8C112E31EFBE~2B92A8EF5E6FA3C13310AFA0F11E5D7BB2A81E656396C0748A18BE21261C7692293890E328D7C7247219A324CE205537",
			PasswdCipher: "20~A2~6216B4BA20DA12F059C83920~92B993CC03F12D6CFDF8F1BB25222A3E79535E236536C4DAEF74D2236ED75CC8CB40764BA8B9E5F047E906B61640345D29400C85D6297402CFF29FC027511963",
			Sysconfig:    []string{"96dcc4082d8e462fae9e4be644907a2b", "d5ac270397dc4990a5d5b854fbcb1d5f"},
			Config:       []string{"c11b9c72fda64080a18f789d3fbe8a84", "26d1f90173614ddd8f7c5575f87d380a"},
		}

		p := new(LocalSecurityDecryptor)
		rs, err := p.DecryptCipher(cp)
		assert.NoError(t, err)
		assert.Equal(t, "YmE2YTIxMjUtZmY0Ny00NTYxLWE2YmYtMjhjODI0ZDg2MmRh", rs)
	})

}
